{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "stu_id = [10001,10002,10003,10004,10008,10001,10009,10010,10001]\n",
    "# 思考，如何取出所有位置10001的index？\n",
    "for i in stu_id:\n",
    "    # 循环遍历stu_id的所有内容\n",
    "    if i == 10001:\n",
    "        # 判断如果元素为10001的时候,怎么取出索引值呢？\n",
    "        print()\n",
    "枚举.\n",
    "for index,item in enumerate(stu_id):\n",
    "    # print(index,item)\n",
    "    if item == 10001:\n",
    "        print(index,item)\n",
    "        pop_values_list.append(index)\n",
    "pop_values_list = []  # append方法经常用于新建列表\n",
    "print(\"我们想要删除pop()的值：\",pop_values_list)\n",
    "4 10000\n",
    "5 10000\n",
    "6 10000\n",
    "我们想要删除pop()的值： [4, 5, 6]\n",
    "\n",
    "\n",
    "stu_id = [10000,10003,10001,10005,10006,10005,10008,10001,10000]\n",
    "# 思考，如何取出所有位置10000的index？\n",
    "names = [\"ji\", \"yue\", \"hy\", \"ss\"]\n",
    "1.增加 append()  增加在list的末尾\n",
    "  names.append(1)\n",
    "  print(names)\n",
    "2. 删除 remove  和 pop\n",
    "多个元素时用remove，用remove一般要加in\n",
    "if 10000 in names:\n",
    "#     names.remove(10001)\n",
    "# print(\"remove删除的结果：\",names)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}